/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number[]}
 */

const data = require('./row-data/treeData')

let inorderTraversal = function(root) {
    let res = []

    const inorder = function (root){
        if(root === null) {
            return null
        }
        root.left && inorder(root.left)
        root.val && res.push(root.val)
        root.right && inorder(root.right)
    }
    inorder(root)
    return res;
};

console.log(inorderTraversal(data));
